﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace SpeakOut.Lib
{
    public class BlogConfig
    {
        private static string _contactEmail;

        /// <summary>
        /// E-mail when to be used by the contact form
        /// </summary>
        public static string ContactEmail
        {
            get
            {
                if (_contactEmail == null)
                {
                    _contactEmail = ConfigurationManager.AppSettings["contactEmail"];
                }
                return _contactEmail;
            }
        }

        private static string _blogEmail;

        /// <summary>
        /// E-mail used by the blog engine.
        /// Comments are send to this address.
        /// </summary>
        public static string BlogEmail
        {
            get
            {
                if (_blogEmail == null)
                {
                    _blogEmail = ConfigurationManager.AppSettings["blogEmail"];
                }
                return _blogEmail;
            }
        }

        private static bool _shouldNotifyNewComment;

        /// <summary>
        /// States if the engine should send an notification e-mail 
        /// when a new comment is posted.
        /// </summary>
        public static bool ShouldNotifyNewComment
        {
            get
            {
                if (_shouldNotifyNewComment)
                {
                    _shouldNotifyNewComment =
                        bool.TrueString.Equals(ConfigurationManager.AppSettings["shouldNotifyNewComment"],
                                               StringComparison.InvariantCultureIgnoreCase);
                }
                return _shouldNotifyNewComment;
            }
        }

        public const string CacheDependecyKey = "CacheDependency";
    }
}
